/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
//<td class=" value"><div class="ui-selectonemenu ui-widget ui-state-default ui-corner-all ui-helper-clearfix" id="j_idt571:j_idt48" style="width: 74px;"><div class="ui-helper-hidden-accessible"><select name="j_idt571:j_idt48_input" id="j_idt571:j_idt48_input"><option selected="selected" value="Male">Male</option><option value="Female">Female</option></select></div><input type="text" value="Male" tabindex="-1" class="ui-selectonemenu-label ui-inputfield ui-corner-all" name="j_idt571:j_idt48_editableInput" style="cursor: pointer; width: 58px;"><div class="ui-selectonemenu-trigger ui-state-default ui-corner-right"><span class="ui-icon ui-icon-triangle-1-s"></span></div></div></td>
//<td class=" value"><div class="ui-selectonemenu ui-widget ui-state-default ui-corner-all ui-helper-clearfix ui-state-disabled" id="j_idt571:j_idt48" style="width: 74px;"><div class="ui-helper-hidden-accessible"><select disabled="disabled" name="j_idt571:j_idt48_input" id="j_idt571:j_idt48_input" tabindex="-1"><option selected="selected" disabled="disabled" value="Male">Male</option><option disabled="disabled" value="Female">Female</option></select></div><input type="text" value="Male" disabled="disabled" tabindex="-1" class="ui-selectonemenu-label ui-inputfield ui-corner-all" name="j_idt571:j_idt48_editableInput" style="width: 58px;"><div class="ui-selectonemenu-trigger ui-state-default ui-corner-right"><span class="ui-icon ui-icon-triangle-1-s"></span></div></div></td>
function decideForm(isDisabled){
    if(isDisabled==='true'){
        disableForm();
    }
    else{
        enableForm();
    }
}

function disableForm() {
    var inputs = document.getElementsByTagName("input");
    for (var i = 0; i < inputs.length; i++) {
        inputs[i].disabled = true;
        cc = inputs[i].getAttribute("class");
        cc+=" ui-state-disabled";
        inputs[i].setAttribute("class", cc);
    }
    var selects = document.getElementsByTagName("select");
    for (var i = 0; i < selects.length; i++) {
        selects[i].disabled = true;
    }
    var textareas = document.getElementsByTagName("textarea");
    for (var i = 0; i < textareas.length; i++) {
        textareas[i].disabled = true;
    }
//    var buttons = document.getElementsByTagName("button");
//    for (var i = 0; i < buttons.length; i++) {
//        buttons[i].disabled = true;
//        }
}

function enableForm() {
    var inputs = document.getElementsByTagName("input");
    for (var i = 0; i < inputs.length; i++) {
        inputs[i].disabled = false;
        cc = inputs[i].getAttribute("class");
        cc = cc.replace("ui-state-disabled", "", "gi");
        inputs[i].setAttribute("class", cc);
    }
    var selects = document.getElementsByTagName("select");
    for (var i = 0; i < selects.length; i++) {
        selects[i].disabled = false;
    }
    var textareas = document.getElementsByTagName("textarea");
    for (var i = 0; i < textareas.length; i++) {
        textareas[i].disabled = false;
    }
//    var buttons = document.getElementsByTagName("button");
//    for (var i = 0; i < buttons.length; i++) {
//        buttons[i].disabled = false;
//    }
}
